package com.peng.controller;

import com.peng.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.mail.MessagingException;

@RestController
public class MainController {
    @Autowired
    MailService mailService;


    @RequestMapping("/main")
    public String main(){
        mailService.send();
        return "OK";
    }

    @RequestMapping("/main2")
    public String main2(){
        try {
            mailService.send2();
        } catch (MessagingException e) {
            e.printStackTrace();
        }
        return "OK";
    }

}
